package com.yunshipei.common.wedigt;

import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.widget.EditText;

import com.yunshipei.common.manager.EnterConfig;
import com.yunshipei.enterplorer.R;
import com.yunshipei.utils.DrawableUtils;

public class EnterplorerPswEditText extends EditText {

    public EnterplorerPswEditText(Context context) {
        super(context);
        init(context);
    }

    public EnterplorerPswEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public EnterplorerPswEditText(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context);
    }

    private void init(Context context) {
        int color = EnterConfig.getInstance().getGlobalColor();
        int radio = context.getResources().getDimensionPixelOffset(R.dimen.btn_radio_size);
        int lineSize = context.getResources().getDimensionPixelOffset(R.dimen.edit_text_line_size);

        setBackground(DrawableUtils.newEditTextBg(radio, color, Color.WHITE, lineSize));
        int padding = context.getResources().getDimensionPixelOffset(R.dimen.edit_text_padding);
        setPadding(padding, padding, padding, padding);
    }
}
